package fitness

import (
	"fitness/internal/service/fitness"
	"fitness/pkg/middleware"
	"github.com/gin-gonic/gin"
)

type DetailController struct {
	DetailService *fitness.DetailService
	Rbac          *middleware.Rbac
}

func NewDetailController(detailService *fitness.DetailService, Rbac *middleware.Rbac) *DetailController {
	return &DetailController{
		DetailService: detailService,
		Rbac:          Rbac,
	}
}

func (api *DetailController) InitApiRouter(engine *gin.Engine) {
	detail := engine.Group("/fitness")
	{
		//退出登陆
		detail.POST("/details", middleware.Jwt, api.DetailService.GetDetails)
		//新增
		detail.POST("/insert", middleware.Jwt, api.DetailService.Insert)
		//修改
		detail.POST("/update", middleware.Jwt, api.DetailService.Update)
		//删除
		detail.DELETE("/:id", middleware.Jwt, api.DetailService.Delete)
		//获取设置课程的数量
		detail.GET("courses/month", middleware.Jwt, api.DetailService.Courses)
	}
}
